#pragma region Licensing
/*
       LOGL::GLib -> LorgonJortle's OpenGL Game Library
       Copyright (C) 2011  Jesse 'LorgonJortle' Wilkerson

       This program is free software: you can redistribute it and/or modify
       it under the terms of the GNU General Public License as published by
       the Free Software Foundation, either version 3 of the License, or
       (at your option) any later version.

       This program is distributed in the hope that it will be useful,
       but WITHOUT ANY WARRANTY; without even the implied warranty of
       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       GNU General Public License for more details.

       You should have received a copy of the GNU General Public License
       along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#pragma endregion

#include "Math.h"

namespace LOGL_GLib
{
     namespace Math
     {

          /******************************************************************************
           GLfloat ToDegrees(GLfloat _Radians);
                    Arguments:
                         GLfloat _Radians:
                              The radians to convert.

                    Description:
                         Convert the specified radians to degrees.

                    Returns:
                         The number of degrees equal to the specified radians.
          *******************************************************************************/
          GLfloat ToDegrees(GLfloat _Radians)
          {
               return (_Radians * 180.0f) / Pi;
          }

          /******************************************************************************
           GLfloat ToRadians(GLfloat _Degrees);
                    Arguments:
                         GLfloat _Degrees:
                              The degrees to convert.

                    Description:
                         Convert the specified degrees to radians.

                    Returns:
                         The number of radians equal to the specified degrees.
          *******************************************************************************/
          GLfloat ToRadians(GLfloat _Degrees)
          {
               return (_Degrees * Pi) / 180.0f;
          }

          /******************************************************************************
           GLfloat Distance2(const Vector2& _A, const Vector2& _B);
                    Arguments:
                         const Vector2& _A:
                              The first vector to work with.
                         const Vector2& _B:
                              The second vector to work with.

                    Description:
                         Calculates the distance between then two points.

                    Returns:
                         The distance between then two points.
          *******************************************************************************/
          GLfloat Distance2(const Vector2& _A, const Vector2& _B)
          {
               return sqrtf(((_B.X - _A.X) * (_B.X - _A.X)) + ((_B.Y - _A.Y) * (_B.Y - _A.Y)));
          }

          /******************************************************************************
           GLfloat Distance3(const Vector3& _A, const Vector3& _B);
                    Arguments:
                         const Vector3& _A:
                              The first vector to work with.
                         const Vector3& _B:
                              The second vector to work with.

                    Description:
                         Calculates the distance between then two points.

                    Returns:
                         The distance between then two points.
          *******************************************************************************/
           GLfloat Distance3(const Vector3& _A, const Vector3& _B)
           {
               return sqrtf(((_B.X - _A.X) * (_B.X - _A.X)) + ((_B.Y - _A.Y) * (_B.Y - _A.Y) + ((_B.Z - _A.Z) * (_B.Z - _A.Z))));
           }

          /******************************************************************************
           GLboolean Equal(GLfloat _A, GLfloat _B);
                    Arguments:
                         GLfloat _A:
                              The left operand.
                         GLfloat _B:
                              The right operand.

                    Description:
                         Determines whether the two floats are equal.

                    Returns:
                         Whether the two floats are equal.
          *******************************************************************************/
          GLboolean Equal(GLfloat _A, GLfloat _B)
          {
               return fabs(_A - _B) < Epsilon;
          }

          /******************************************************************************
           GLboolean IsZero(GLfloat _A);
                    Arguments:
                         GLfloat _A:
                              The left operand.

                    Description:
                         Determines whether the float is equal to zero.

                    Returns:
                         Whether the float is equal to zero.
          *******************************************************************************/
          GLboolean IsZero(GLfloat _A)
          {
               return fabs(_A) < Epsilon;
          }

          /******************************************************************************
           GLfloat Max(GLfloat _A, GLfloat _B);
                    Arguments:
                         GLfloat _A:
                              The left operand.
                         GLfloat _B:
                              The right operand.

                    Description:
                         Returns the higher of the two floats.

                    Returns:
                         The higher of the two floats.
          *******************************************************************************/
          GLfloat Max(GLfloat _A, GLfloat _B)
          {
               return _A > _B ? _A : _B;
          }

          /******************************************************************************
           GLfloat Min(GLfloat _A, GLfloat _B);
                    Arguments:
                         GLfloat _A:
                              The left operand.
                         GLfloat _B:
                              The right operand.

                    Description:
                         Returns the lower of the two floats.

                    Returns:
                         The lower of the two floats.
          *******************************************************************************/
          GLfloat Min(GLfloat _A, GLfloat _B)
          {
               return _A < _B ? _A : _B;
          }

     } /* Namespace Math. */
} /* Namespace LOGL_GLib. */
